package learningThread.syn.synchronizedMethodLockObj.synchronizeException;

/**
 * 当一个线程发生异常时，会立即释放对象锁以供其他线程调用
 */
public class SynchronizeException {

    public static void main(String[] args) {
        OperationObj operationObj = new OperationObj();
        Thread thread = new Thread(){
            @Override
            public void run() {
                operationObj.method("a");
            }
        };

        Thread thread1 = new Thread(){
            @Override
            public void run() {
                operationObj.method("b");
            }
        };
        thread.start();
        thread1.start();
    }
}
